<!-- NEWS -->
<div class="manager">
	<input type="hidden" id="token" name="token" value="<?php echo $this->token(); ?>" />
	<div class="mainActions"><a href="#" onclick="createItem('products');" class="create-bt">AJOUTER</a> <a href="#" onclick="updateAll('products');" class="updateall-bt">UPDATER</a> <a href="#" onclick="deleteGroup('products');" class="delselected-bt">SUPPRIMER LES ITEMS SELECTIONNES</a> <a href="#" onclick="reloadView('#moduleInclude', 'products');" class="create-bt">REFRESH</a></div>
	<?php
		foreach ($this->tproducts() as $product) {
	?>
	<div class="item">
		<div class="queries">
			<form name="newsForm" class="<?php echo $product->id(); ?>" action="#">
				<a href="#" onclick="deleteItem(<?php echo $product->id(); ?>, 'products');" class="delete-bt"></a>
				<a href="#" onclick="updateItem(<?php echo $product->id(); ?>, 'products');" class="update-bt"></a>
				<span class="size10">DISPLAY</span> <input style="vertical-align:-6px;" type="checkbox" class="display" name="display" value="1" <?php if($product->display()==1){echo ' checked';} ?>>
				<span class="size10">DELETE</span> <input style="vertical-align:-6px;" type="checkbox" class="delete" name="delete" value="1">
				<input type="hidden" class="id" name="id" value="<?php echo $product->id(); ?>" />
				<input type="text" class="title" name="title" value="<?php echo $product->title(); ?>" /><br />
				<input type="text" class="date" name="date" value="<?php echo $product->date(); ?>" /><br />
				<input type="text" class="link" name="link" value="<?php echo $product->link(); ?>" /><br />
				<textarea class="text" name="text"><?php echo $product->text(); ?></textarea>
				<?php
					foreach ($product->adds() as $add) {
						?>
							<span class="size10"><?php echo $add->title(); ?></span> <input style="vertical-align:-6px;" type="checkbox" class="adds" name="adds" value="<?php echo $add->id(); ?>" <?php if($add->display()==1){echo ' checked';} ?>>
						<?php
					}
				?>
			</form>
		</div>
		<div class="output products" id="<?php echo $product->id(); ?>">
			<?php
			if (count($product->imgsTab()) > 0) {
				foreach($product->imgsTab() as $img){
					?>
					<div class="thumb" style="background:url('<?php echo $img['small']; ?>') center center no-repeat; background-size:cover;"><a href="<?php echo $img['original']; ?>" target="_blank"></a></div><a class="delete-img" href="#" onclick="delete_img('<?php echo $img['original']; ?>', 'products');"></a>
					<?php
				}
				?>
					<!--<div class="progress"><div class="int"></div></div>-->
				<?php
			}
			else {
				?>
					<p>DROP BACKGROUND HERE<br /><img src="<?php echo URL_TPL; ?>backoffice/assets/img/drop.png" /></p>
				<?php
			}
			?>
		</div>
	</div>
	<?php
		}
	?>
</div>

<script type="text/javascript">
	$(document).ready(function() {
		$('.date').each(function(){
			$(this).datepicker({dateFormat:'yy-mm-dd'});
		});
	});
	$(".output").dropfile({maxfiles:1, dir:'products/', module:'products'});
</script>